<?php
class Gallery_MenuController extends XPHP_Controller
{
	public function viewAction()
	{
	}
	#[Authorize(roles = 'Administrator')]
	public function createAction()
	{
		$model = new Areas_Gallery_Models_Gallery();
        //Lấy ra danh sách danh mục theo dạng cây
        $galleries = $model->getGalleries();
        //Lấy ra mảng đưa vào hộp select
        $options = array();
        foreach ($galleries as $gallery) {
            $options[$this->url->action('index', 'Index', 'Gallery', array($gallery->id))] = $gallery->name;
        }
        //Assign sang view
        $this->view->galleryOptions = $options;
        
		return $this->view();
	}
	#[Authorize(roles = 'Administrator')]
	public function editAction()
	{
		$model = new Areas_Gallery_Models_Gallery();
        //Lấy ra danh sách danh mục theo dạng cây
        $galleries = $model->getGalleries();
        //Lấy ra mảng đưa vào hộp select
        $options = array();
        foreach ($galleries as $gallery) {
            $options[$this->url->action('index', 'Index', 'Gallery', array($gallery->id))] = $gallery->name;
        }
        //Assign sang view
        $this->view->galleryOptions = $options;
        
        //Value
        $this->view->value = $this->url->action('index', 'Index', 'Gallery', array($this->params[0]));
		return $this->view();
	}
}